<template>
  <el-dialog
    :title="title"
    :visible.sync="dialogCircle"
    @close="cancelAdd"
  >
    <el-form :model="friendForm" ref="friendForm">
        <el-form-item label="标题：" :label-width="formLabelWidth" prop="projectName">
          <span>{{form.projectName}}</span>
        </el-form-item>
        <el-form-item label="状态：" :label-width="formLabelWidth" prop="status">
          <template slot-scope="scope">
            <span v-if="scope.row.status == 0" class="tag-text">删除</span>
            <span v-if="scope.row.status == 1" class="tag-text">审核通过</span>
            <span v-if="scope.row.status == 2" class="tag-text">待审核</span>
            <span v-if="scope.row.status == 3" class="tag-text">审核失败</span>
            <span v-if="scope.row.status == 4" class="tag-text">取消</span>
          </template>
        </el-form-item>
        <el-form-item label="品牌ip内容权：" :label-width="formLabelWidth" prop="brandIpContentRights">
          <span>{{form.brandIpContentRights}}</span>
        </el-form-item>
        <el-form-item label="负责人：" :label-width="formLabelWidth" prop="curator">
          <span>{{form.curator}}</span>
        </el-form-item>
        <el-form-item label="联系电话：" :label-width="formLabelWidth" prop="phone">
          <span>{{form.phone}}</span>
        </el-form-item>
        <el-form-item label="项目内容：" :label-width="formLabelWidth" prop="content">
          <span>{{form.content}}</span>
        </el-form-item>

        <el-form-item label="" :label-width="formLabelWidth">
          <template slot-scope="scope">
            <div class="prod-image" >
              <prod-pic
                :pic="orderItem"  v-for="(orderItem, index) in setList(form.contentImg)"
              ></prod-pic>
            </div>
          </template>
        </el-form-item>
      <el-form-item label="品牌价值：" :label-width="formLabelWidth" prop="brandValue">
        <span>{{form.brandValue}}</span>
      </el-form-item>

      <el-form-item label="" :label-width="formLabelWidth">
        <template slot-scope="scope">
          <div class="prod-image">
            <prod-pic
              :pic="orderItem"  v-for="(orderItem, index) in setList(form.brandValueImg)"
            ></prod-pic>
          </div>
        </template>
      </el-form-item>
        <el-form-item label="创建时间：" :label-width="formLabelWidth" prop="createTime">
          <span>{{form.createTime}}</span>
        </el-form-item>
        <el-form-item label="审核失败原因：" :label-width="formLabelWidth" v-if="form.status == 3" prop="remark">
          <span>{{form.remark}}</span>
        </el-form-item>

        <el-form-item label="审核时间：" :label-width="formLabelWidth" v-if="form.status == 3" prop="updateTime">
          <span>{{form.updateTime}}</span>
        </el-form-item>
        <el-form-item style="display: flex;justify-content: flex-end; margin-right: 20px;margin-bottom: 20px;">
          <el-button  @click="cancelAdd">取 消</el-button>
        </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
import ProdPic from '@/components/prod-pic'
  export default {
    components: {
      ProdPic
    },
    data () {
      return {
        resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
        formLabelWidth: '120px',
        dialogCircle: false, // 朋友圈详情
        friendForm: {},
        form: {},
        title: '详情',
        reportType: 0
      }
    },
    created () {},
    methods: {
      setList(list){
        if(list.indexOf(',')==-1){
          return [list]
        }else{
          return list.split(',')
        }
      },
      init (row) {
          this.title = '详情'
          this.dialogCircle = true
          this.$http({
            url: this.$http.adornUrl('/admin/project/project/getProjectInfo'),
            method: 'get'
            , params: this.$http.adornParams({
              projectId: row.projectId
            })
          }).then(({data}) => {
            this.form = data
          })
      },
      cancelAdd: function () {
        this.dialogSquare = false
        this.form = {}
      }
    }
  }
</script>

<style lang="scss">
.prod-image {
  display: flex;
}
.prod-image img{
  width: 200px;
  height: 200px;
  margin-right: 20px;
}
</style>
